<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="keywords" content="广东国防教育学会">
    <meta name="description" content="广东国防教育学会">
    <title>广东国防教育学会</title>
    <link rel="shortcut icon" href="/Public/Admin/img/favicon.ico">
    <link href="/Public/Admin/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/Admin/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/Admin/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" href="/Public/Admin/bootstrap_validator-0.4.5/dist/css/bootstrapValidator.css"/>
    <link href="/Public/Admin/css/animate.min.css" rel="stylesheet">
    <link href="/Public/Admin/plugins/iCheck/all.css" rel="stylesheet">
    <style>
		/* *{
			color:#000;
		} */
		.btn{
		 	 padding: 5px 8px;
		 	 /* border-radius: 0px; */
			font-size:12px;
			margin-bottom:0px;
		}
		.table{
	    	width: 100%;
		}
		.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
			padding:0px 5px;
			/*text-align: center;*/
			vertical-align: middle!important;
		}
		.form-control{
			font-size: 12px;
		}
		#file-pretty button{
			padding: 7.5px 13px;
		}
		p{
	   		 margin: 0 0;
		}
		.pagination{
			margin:0px 0px;
		}
		.select_width{
			width:100px;
		}
		.select_no_border{
			border-right: none;
		}
	</style>
</head>
<style>
	.pagination{
		margin:5px 0px;
	}
	.pagination a{
		background-color: #f4f4f4;
		z-index: 2;
		border:1px solid #000;
		border-color: rgb(221, 221, 221);
		padding: 4px 10px;
		margin:0px 0px;
	}
	.pagination .current{
		background-color: #1ab394;
		z-index: 2;
		border:1px solid #000;
		border-color: #1ab394;
		padding: 4px 10px;
		margin:0px 0px;
		color:#fff;
	}
	.select_no_border{
		border-right: none;
	}
	.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{
		padding:0px 5px;
		text-align: center;
		vertical-align: middle!important;
	}
</style>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="ibox-title">
					<h5>申请列表</h5>
					<div class="ibox-tools" style="margin-top: -6px;">
						<a href="/Admin/<?php echo (CONTROLLER_NAME); ?>/<?php echo (ACTION_NAME); ?>" class="btn btn-primary"><i class="fa fa-refresh"></i> 刷新</a>
					</div>
				</div>
				<div class="ibox-content">
					<div class="row">
						<div class="col-sm-3">
							<a href="/Admin/Apply/applyView?act=add" class="btn btn-primary">
								<span class="fa fa-plus"></span>
								添加专家
							</a>
						</div>
						<form class="form-inline" action="/Admin/Apply/applyList" method="get">
							<div class="col-sm-9">
								<div class="input-group col-sm-4  pull-right">
									<input type="text" name="user_name" value="<?php echo I('user_name');?>" placeholder="请输入用户名" class="input-sm form-control">
									<span class="input-group-btn">
										<button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
									</span>
								</div>
								<div class="input-group col-sm-2 pull-right">
									<input type="text" name="phone" value="<?php echo I('phone');?>" placeholder="请输入电话号码" class="input-sm form-control select_no_border">
								</div>
								<div class="input-group col-sm-2 pull-right">
									<select name="status" class="input-sm form-control select_no_border">
										<option value="">请选择审核状态</option>
										<option <?php if(I('status') == 1): ?>selected<?php endif; ?> value="1">已通过</option>
										<option <?php if(I('status') == 2): ?>selected<?php endif; ?> value="2">待审核</option>
										<option <?php if(I('status') == 3): ?>selected<?php endif; ?> value="3">不通过</option>
									</select>
								</div>
								<div class="input-group col-sm-2 pull-right">
									<select name="type" class="input-sm form-control select_no_border">
										<option value="">请选择申请类型</option>
										<option <?php if(I('type') == 1): ?>selected<?php endif; ?> value="1">军事专家</option>
										<option <?php if(I('type') == 2): ?>selected<?php endif; ?> value="2">国防专家</option>
										<option <?php if(I('type') == 3): ?>selected<?php endif; ?> value="3">医学专家</option>
									</select>
								</div>

							</div>
						</form>
					</div>

					<br />

					<div class="table-responsive">
						<form id="allDelForm" action="/Admin/Apply/operate" method="post" >
							<input type="hidden" name="model" value="apply">
							<table class="table table-bordered table-hover"
								   id="categoryTable">
								<thead>
								<tr class="active">
									<th><input onclick="choosebox(this)" type="checkbox" /></th>
									<th height="40">编号</th>
									<th>专家姓名</th>
									<th>单位名称</th>
									<th>电话</th>
									<th>邮箱</th>
									
									<!--<th>材料图片</th>-->
									<th>申请类型</th>
									<th>审核状况</th>
                                                                        <th>是否推荐</th>
                                                                        <th>补充说明</th>
									<th  width="10%">申请时间</th>
									<th width="100">操作</th>
								</tr>
								</thead>
								<tbody>
								<?php if(is_array($apply)): foreach($apply as $key=>$data): ?><tr>
									<td><input type="checkbox" name="id[]" value="<?php echo ($data['id']); ?>" /></td>
									<td><?php echo ($data['id']); ?></td>
									<td><?php echo ($data['user_name']); ?></td>
									<td><?php echo ($data['job_name']); ?></td>
									<td><?php echo ($data['phone']); ?></td>
									<td><?php echo ($data['email']); ?></td>
									
									<!--<td><img src="<?php echo ($data['img']); ?>"></td>-->
									<td>
										<?php switch($data['type']): case "1": ?>军事专家<?php break;?>
										<?php case "2": ?>国防专家<?php break;?>
										<?php case "3": ?>医学专家<?php break; endswitch;?>
									</td>
									<td style="padding: 0px;">
<!--                                                                            <?php switch($data['status']): case "1": ?>已通过<?php break;?>
                                                                                <?php case "2": ?>待审核<?php break;?>
                                                                                <?php case "3": ?>不通过<?php break; endswitch;?>-->
										<div style="width: auto;border:none;">
											<select style="border:none;" class="form-control" onchange="updateStatus(<?php echo ($data['id']); ?>, 'apply',this.options[this.options.selectedIndex].value)">
												<option <?php if($data['status'] == 1): ?>selected<?php endif; ?> value="1">已通过</option>
												<option <?php if($data['status'] == 2): ?>selected<?php endif; ?> value="2">待审核</option>
												<option <?php if($data['status'] == 3): ?>selected<?php endif; ?> value="3">不通过</option>
											</select>
										</div>
									</td>
                                                                        <td><?php if($data['is_top'] == 1): ?>是<?php else: ?>否<?php endif; ?></td>
                                                                        <td title="<?php echo (htmlspecialchars_decode($data['explain'])); ?>"><?php echo (mb_substr(htmlspecialchars_decode($data['explain']),0,10,"utf-8")); ?>...</td>
									<td><?php echo (date("Y-m-d",$data['add_time'])); ?></td>
									<td class="center">
										<div class="dropdown">
											<button class="btn btn-primary dropdown-toggle"
													type="button" id="dropdownMenu1" data-toggle="dropdown"
													aria-haspopup="true" aria-expanded="true">
												操作
												<span class="caret"></span>
											</button>
											<ul class="dropdown-menu" style="min-width: 90px;" aria-labelledby="dropdownMenu1">
												<li>
													<a role="button" class="btn btn-primary"
													   style="margin-bottom: 0px;"
													   href="/Admin/Apply/applyView?id=<?php echo ($data['id']); ?>&act=edit">
														<span class="fa fa-edit"></span>
														查看
													</a>
												</li>
												<li>
													<a role="button" class="btn btn-danger"
													   style="margin-bottom: 0px;"
													   onclick="deleteData(this,<?php echo ($data['id']); ?>,'apply')" href="javascript:void(0);">
														<span class="fa fa-trash-o"></span>
														删除
													</a>
												</li>
											</ul>
										</div>
									</td>
								</tr><?php endforeach; endif; ?>
								</tbody>
							</table>
                                                        		<div class="col-sm-4" style="padding-left:0px;"> 
									<select id="operate" name="operate" class="input-sm form-control pull-left" style="width:100px;margin-right: 5px;">
										<option value="0">选择操作</option>
                                                                                <option value="pass">通过审核</option>
                                                                                <option value="wait">等待审核</option>
                                                                                <option value="defeated">审核不通过</option>
                                                                                <option value="del">删除</option>
                                                                        </select>
				                     <button tpye="button"  class="btn btn-primary pull-left"> 确认</button>
			                    </div>

						</form>
<!--						<div style="padding-left:0px;" class="col-sm-3 text-left">
							<button id="allDel" class="btn btn-danger">删除</button>
						</div>-->
						<div class="col-sm-12 text-right">
							<nav aria-label="Page navigation">
								<ul class="pagination">
									<?php echo ($page); ?>
								</ul>
							</nav>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script src="/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/Admin/js/bootstrap.min.js?v=3.3.6"></script>
<!-- <script src="/Public/Admin/js/content.min.js?v=1.0.0"></script> -->
<script type="text/javascript" src="/Public/Admin/bootstrap_validator-0.4.5/dist/js/bootstrapValidator.js"></script>
<script src="/Public/Admin/plugins/layer/layer.js"></script>
<script src="/Public/Admin/plugins/iCheck/icheck.min.js"></script>

<script>
//设置checkbox按钮
$('.i-check').iCheck({
	checkboxClass : "icheckbox_square-green",
	radioClass : "iradio_square-green",
});
</script>

</body>
</html>
<script>
    function choosebox(o){
        var vt = $(o).is(':checked');
        if(vt){
            $('input[type=checkbox]').prop('checked',vt);
        }else{
            $('input[type=checkbox]').removeAttr('checked');
        }
    }
    $("#allDel").click(function () {
        layer.confirm('确定要删除数据吗', {btn: ['确认', '取消'], icon: 3, closeBtn: 2}, function (index) {
            $("#allDelForm").submit();
        });
    })
</script>


<script>
	$(document).ready(function () {
	    $(".pagination li").eq(0).removeClass('disabled');
    });
</script>

<script>
    
    //删除
    function deleteData(obj,id,model){
        layer.confirm('确定要删除数据吗',{btn:['确认','取消'], icon:3, closeBtn: 2 },function(index){
            $.ajax({
                url : '/Admin/Apply/dataDel',
                data : {'id':id,model:model},
                type : 'get',
                dataType : 'json',
                async : false,   //取消同步，执行完之后再往下执行
                success : function(data){
                    if(data.status == 1){
                        layer.msg(''+data.message+'',{icon:2,time:1000});
                        $(obj).parent('li').parent('ul').parent('div').parent('td').parent('tr').remove();
                    }else if(data.status == 2){
                        layer.msg(''+data.message+'',{icon:1,time:1000});
                    }
                }
            });
        });
    }

	//状态
    function updateStatus(Id,model,status) {
        $.ajax({
            url : "/Admin/Apply/statusEdit",
            type : "GET",
            dataType : "JSON",
            data : {
                Id : Id,
		model:model,
                status : status,
            },
            success : function(data) {
                if(data.status == 1) {
                    layer.msg('操作成功',{time:2000});
                } else {
                    layer.msg('操作失败',{time:2000});
                }
            }
        });
    }
</script>
</body>
</html>